import java.util.ArrayList;
import java.util.List;

public class java0528 {
    public static int[] reorderOddEven(int[] nums) {
        if (nums == null || nums.length == 0) {
            return nums;
        }

        List<Integer> result = new ArrayList<>();
        // 先添加所有奇数
        for (int num : nums) {
            if (num % 2 != 0) {
                result.add(num);
            }
        }
        // 再添加所有偶数
        for (int num : nums) {
            if (num % 2 == 0) {
                result.add(num);
            }
        }
        // 转换为数组
        return result.stream().mapToInt(i -> i).toArray();
    }

    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 5, 6};
        System.out.println("调整前：" + java.util.Arrays.toString(nums));
        int[] reordered = reorderOddEven(nums);
        System.out.println("调整后：" + java.util.Arrays.toString(reordered));
    }
}